import maya.cmds as cmds
class jointCurveBlend():
	def __init__(self,jntLable):
		self.jntLable	= jntLable
	def CurveInfo(self,curveSurface,curveSurfaceAim,numberGrp):
		curveSpace = cmds.listRelatives(curveSurface)
		curveAimSpace = cmds.listRelatives(curveSurfaceAim)
		curveMaxValue = cmds.getAttr(curveSurface+'.maxValue')

		for i in range(numberGrp):
			pciNode = cmds.createNode('pointOnCurveInfo',name = self.jntLable +'_Pci' + str(i))
			aimPciNode = cmds.createNode('pointOnCurveInfo',name = self.jntLable +'_AimPci'+  str(i))
			aimPciTransform = cmds.createNode('transform',name = self.jntLable +'_AimPciGrp'+  str(i))
			pciTransform = cmds.createNode('transform',name =  self.jntLable +'_PciGrp'+ str(i))

			jnt = cmds.joint( name =self.jntLable +'_Jnt'+str(i))
			cmds.select()
			cmds.addAttr(jnt ,longName = 'parameter',at = 'double')
			cmds.setAttr(jnt+'.parameter',edit=True,keyable = True)
			cmds.connectAttr(jnt+'.parameter',pciNode+'.parameter')
			cmds.connectAttr(jnt+'.parameter',aimPciNode+'.parameter')

			cmds.connectAttr(curveSpace[0]+'.worldSpace[0]',pciNode+'.inputCurve')
			cmds.connectAttr(pciNode+'.positionX',pciTransform+'.translateX')
			cmds.connectAttr(pciNode+'.positionY',pciTransform+'.translateY')
			cmds.connectAttr(pciNode+'.positionZ',pciTransform+'.translateZ') 

			cmds.connectAttr(curveAimSpace[0]+'.worldSpace[0]',aimPciNode+'.inputCurve')
			cmds.connectAttr(aimPciNode+'.positionX',aimPciTransform+'.translateX')
			cmds.connectAttr(aimPciNode+'.positionY',aimPciTransform+'.translateY')
			cmds.connectAttr(aimPciNode+'.positionZ',aimPciTransform+'.translateZ') 

			if curveMaxValue > 1 :
				cmd = ( int(curveMaxValue) * 0.1 * 10) / (numberGrp - 1 )
			elif curveMaxValue == 1:
				cmd =  1.0 / (numberGrp - 1)
			

			cmds.setAttr(jnt+'.parameter',(cmd*i)) 
			cmds.setAttr(jnt+'.parameter',(cmd*i)) 

			cmds.tangentConstraint(curveSurface,pciTransform,weight=True,aimVector=(1,0,0),upVector=(0,1,0),worldUpType='object',worldUpObject = aimPciTransform )

aa = jointCurveBlend('backPiece_back_')
aa.CurveInfo('a','b',15)